//
// Created by sally on 24-10-27.
//

#include "Timer_holder.h"

#include <thread>
#include <iostream>
using namespace whq::timer;

Timer_holder::Timer_holder()
    :m_time_point_(std::chrono::steady_clock::now())
{
}

void Timer_holder::holder(const std::chrono::microseconds microseconds) const
{
    // std::cout<<"holder函数2"<<std::endl;
    //这是需要延时多少毫秒来执行任务
    std::this_thread::sleep_until(m_time_point_ + microseconds);
}

// 重置time_holder计时时间
void Timer_holder::reset()
{
    m_time_point_ = std::chrono::steady_clock::now();
}

